package jiang.jvm;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @ClassName Demo03
 * @Description: finally的测试
 * @Author jiangshitao
 * @Date 2023/2/23
 */
public class Demo03 {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        int min = 0;
        int index = 0;
        // 填充数组
        for (int i = 0; i < 10; i++) {
            Random random = new Random();
            int nextInt = random.nextInt(10);
            list.add(nextInt);
        }
        for (int j = 0; j < list.size(); j++) {
            if (j == 0) {
                min = list.get(j);
                continue;
            }
            if (list.get(j) < min) {
                min = list.get(j);
                index = j;
            }

        }
        System.out.println(list);
        System.out.println(index + "," + min);
//        int result = test();
//        System.out.println(result);
    }
    public static int test() {
        try {
            return 10;
        } finally {
            return 20;
        }
    }
}
